<template>
  <div id="app">
    Clicked: {{ $store.state.count }} times, count is {{ obj }}.
    <button @click="increment">+</button>
    <input v-model="$store.state.miss">
    <p @click="tryandtry()">{{name}}</p>
    <p>{{b[0]}} & {{b.length}}</p>
    <input type="checkbox" id="test" v-model="toggle" true-value="yes" false-value="no">
    <!--<button @click="decrement">-</button>-->
    <!--<button @click="incrementIfOdd">Increment if odd</button>-->
    <!--<button @click="incrementAsync">Increment async</button>-->
  </div>
</template>

<script>
  // import Vue from 'vue'
  import { mapGetters, mapActions } from 'vuex'
  export default {
    data () {
      return {
        b: [1, 2, 3],
        toggle: 'no'
      }
    },
    computed: {
      ...mapGetters({
        obj: 'evenOrOdd1',
        name: 'fullName'
      })
    },
    methods: {
      ...mapActions([
        'increment',
        'decrement',
        'incrementIfOdd',
        'incrementAsync'
      ]),
      tryandtry () {
        // this.b[0] = 'a'
        // this.b.splice(0, 2, 'b', 'a', 'd') // 起始位置、删除长度、替换值
        this.b.splice(5)
        console.log('123456789')
      }
//      ...mapMutations([
//        'increment'
//      ])
    }
  }
</script>

